package com.shi.util;

import com.shi.entity.vo.SessionAccountVO;

import java.util.List;

public class UserContext {

    private static ThreadLocal<SessionAccountVO> threadLocal=new ThreadLocal<>();

    public static Integer userId(){
        return threadLocal.get().getUid();
    }

    public static void set(SessionAccountVO sessionAccountVO){
        threadLocal.set(sessionAccountVO);
    }

    public static void remove(){
        threadLocal.remove();
    }
    public static SessionAccountVO get(){
        return threadLocal.get();
    }

    public static List<String> getAuthority(){
        return threadLocal.get().getPermissionCodeList();
    }
}
